package com.wdciti.sccp.iot.gateway.autoconfig;

import com.wdciti.sccp.iot.common.endpoint.EndpointConfig;
import com.wdciti.sccp.iot.common.endpoint.EndpointType;
import com.wdciti.sccp.iot.common.endpoint.UseEndpoint;
import com.wdciti.sccp.iot.springvertx.configure.VerticleConfig;
import com.wdciti.sccp.iot.springvertx.protocols.tcp.SimpleTcpServerVerticle;
import com.wdciti.sccp.iot.springvertx.protocols.tcp.TcpEndpointConfig;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @author JINWEN
 */
@Component
@VerticleConfig
public class GatewayConfiguration {

    @Bean
    @ConfigurationProperties(prefix = "ely.iot.endpoints.tcp-server.myd")
    @UseEndpoint(endpointClass = SimpleTcpServerVerticle.class)
    EndpointConfig mydTcpServerConf() {
        TcpEndpointConfig cfg = new TcpEndpointConfig();
//        cfg.setName("myd");
        cfg.setEndpointType(EndpointType.TCP_SERVER);
//        cfg.setPort(9999);
        return cfg;
    }

}
